package com.dotflat.check.domain.C.PO;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import javax.xml.bind.JAXBException;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.Date;
import java.util.List;

@Data
@XmlRootElement(name = "GetGuardianListInfo2Result")  // 父节点名称
@XmlAccessorType(XmlAccessType.FIELD) //定义这个类中的何种类型需要映射到XML
public class GetGuardianListInfo2Result {

    @JSONField(name = "Birth")
    Date Birth = new Date();
    @JSONField(name = "Career")
    Integer Career = 0;
    @JSONField(name = "Cccupation")
    String Cccupation = null;
    @JSONField(name = "DocumentType")
    Integer DocumentType = 0;
    @JSONField(name = "Education")
    Integer Education = 0;
    @JSONField(name = "Email")
    String Email = null;
    @JSONField(name = "GuardianImg")
   String GuardianImg = null;
    @JSONField(name = "GuardianInfoId")
    Integer GuardianInfoId = 0;
    @JSONField(name = "Guardianlevel")
    Integer Guardianlevel = 0;
    @JSONField(name = "HomeAddress")
    String HomeAddress = null;
    @JSONField(name = "IdCard")
    String IdCard = "";
    @JSONField(name = "InternetByPhone")
    Integer InternetByPhone = 0;
    @JSONField(name = "InternetInfo")
    Integer InternetInfo = 0;
    @JSONField(name = "IsMainPickupPerson")
    Integer IsMainPickupPerson = 0;
    @JSONField(name = "IsMembers")
    String IsMembers = null;
    @JSONField(name = "KgId")
    Integer KgId = 0;
    @JSONField(name = "MainUserId")
    String MainUserId = "";//用户ID
    @JSONField(name = "Modifier")
    String Modifier = "";//园区
    @JSONField(name = "ModifyTime")
    String ModifyTime = "";//时间
    @JSONField(name = "Name")
    String Name = "";
    @JSONField(name = "Nationality")
    Integer Nationality = 0;
    @JSONField(name = "OverseasChinese")
    Integer OverseasChinese = 0;
    @JSONField(name = "Phone")
    String Phone = "";
    @JSONField(name = "PinYin")
    String PinYin;
    @JSONField(name = "QQ")
    String QQ = "";
    @JSONField(name = "Relationship")
    Integer Relationship = 0;
    @JSONField(name = "Remark")
    String Remark = "";
    @JSONField(name = "Sex")
    Integer Sex = 0;
    @JSONField(name = "UserId")
    String UserId = "";
    @JSONField(name = "WorkUnit")
    String WorkUnit = "";
    @JSONField(name = "WxCode")
    String WxCode = "";
    @JSONField(name = "ChildId")
    String ChildId = "";
    @JSONField(name = "EducationName")
    String EducationName = "";
    @JSONField(name = "GuardianlevelName")
    String GuardianlevelName = "";
    @JSONField(name = "RelationshipName")
    String RelationshipName = "";
    @JSONField(name = "SexName")
    String SexName = "";


    /**
     * 将对象转为流程XML
     *
     * @return
     * @throws JAXBException
     */
    public static String convertToXML(List<GetGuardianListInfo2Result> list) {
        String data = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
                "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\n" +
                "    <soap:Body>\n" +
                "        <GetGuardianListInfo2Response xmlns=\"http://tempuri.org/\">\n" +
                "            <GetGuardianListInfo2Result>${v}</GetGuardianListInfo2Result>\n" +
                "        </GetGuardianListInfo2Response>\n" +
                "    </soap:Body>\n" +
                "</soap:Envelope>";
        String xmlStr = JSON.toJSONString(list);
        data = data.replace("${v}", xmlStr);
        return data;
    }

}
